<?php
/*
	插件概览
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';

if($_RQ['op']=='get'){
	//显示统计数据
	$daytime = mktime(0,0,0,date('m'),date('d'),date('Y'));
	$order['all']=pdo_count('jy_weishop_order',array('uniacid'=>$_SESSION['uniacid'],'status'=>3));
	$order['day']=pdo_count('jy_weishop_order',array('uniacid'=>$_SESSION['uniacid'],'status'=>3,'createtime >'=>$daytime));
	$money['all']=pdo_count('jy_weishop_order',array('uniacid'=>$_SESSION['uniacid'],'status'=>3));
	$money['day']=pdo_count('jy_weishop_order',array('uniacid'=>$_SESSION['uniacid'],'status'=>3,'createtime >'=>$daytime));
	
	$order['table']=pdo_count('jy_weishop_order',array('uniacid'=>$_SESSION['uniacid'],'status'=>3,'buytype'=>1));
	$order['out']=pdo_count('jy_weishop_order',array('uniacid'=>$_SESSION['uniacid'],'status'=>3,'buytype'=>2));
	$order['self']=pdo_count('jy_weishop_order',array('uniacid'=>$_SESSION['uniacid'],'status'=>3,'buytype'=>3));
	$order['yuyue']=pdo_count('jy_weishop_order',array('uniacid'=>$_SESSION['uniacid'],'status'=>3,'buytype'=>4));
	
	$money['table']=pdo_count('jy_weishop_order',array('uniacid'=>$_SESSION['uniacid'],'status'=>3,'buytype'=>1));
	$money['out']=pdo_count('jy_weishop_order',array('uniacid'=>$_SESSION['uniacid'],'status'=>3,'buytype'=>2));
	$money['self']=pdo_count('jy_weishop_order',array('uniacid'=>$_SESSION['uniacid'],'status'=>3,'buytype'=>3));
	$money['yuyue']=pdo_count('jy_weishop_order',array('uniacid'=>$_SESSION['uniacid'],'status'=>3,'buytype'=>4));
	$htmls=array(
		array('type'=>'data','num'=>12,'one_num'=>3,'title'=>'总门店数据','datas'=>array(
			array('title'=>'总订单数','num'=>1,'data'=>$order['all']),
			array('title'=>'订单金额','num'=>1,'data'=>$money['all']),
			array('title'=>'访客统计','num'=>1,'data'=>1),
			array('title'=>'总用户','num'=>1,'data'=>1),
		)),
		array('type'=>'data','num'=>12,'one_num'=>3,'title'=>'今日门店数据','datas'=>array(
			array('title'=>'订单数','num'=>1,'data'=>$order['day']),
			array('title'=>'订单金额','num'=>1,'data'=>$money['day']),
			array('title'=>'访客统计','num'=>1,'data'=>1),
			array('title'=>'今日用户','num'=>1,'data'=>1),
		)),
		
	);
	$return=array('htmls'=>$htmls);
	$commission_pie=array(
		'title'=>'支付方式',
		'tablename'=>$this->tablename('order'),
		'width'=>'50%',
		'field'=>'paytype',
		'field_options'=>get_pay_types(),
		'params'=>array('uniacid'=>$_SESSION['uniacid']),
	);
	$return['htmls'][]=model('core/echart')->pie($commission_pie);
	$balance_pie=array(
		'title'=>'订单状态',
		'tablename'=>$this->tablename('order'),
		'width'=>'50%',
		'field'=>'status',
		'field_options'=>$this->order_status,
		'params'=>array('uniacid'=>$_SESSION['uniacid']),
	);
	$return['htmls'][]=model('core/echart')->pie($balance_pie);
	exi($return);
}